package com.dhkj.circle.db.sqlserver;

import com.dhkj.circle.utils.DBHelper;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import static com.dhkj.circle.ui.AppContext.sLogger;

public class GSbaseDBSQL {
    private static GSbaseDBSQL gSbaseDBSQL = new GSbaseDBSQL();

    public static GSbaseDBSQL getInstance() {
        return gSbaseDBSQL;
    }

    public boolean checkGS(String cardno, String kh) {
        boolean status = false;
        DBHelper dbHelper = new DBHelper();
        Connection connection = dbHelper.getConnector3();
        PreparedStatement semt = null;
        ResultSet rs = null;
        try {
            semt = connection.prepareStatement("SELECT * FROM GS where CARDNO=? and KH=?");
            semt.setString(1, cardno);
            semt.setString(2, kh);
            semt.setQueryTimeout(10);
            rs = semt.executeQuery();
            if (rs.next()) {
                status = true;
            }
        } catch (Exception e) {
            sLogger.d(e.getMessage());
        }finally {
            dbHelper.close(connection, semt, rs);
        }
        return status;
    }
}
